package com.zat.mes.andrmes.dofun.work.adapter

import android.text.TextUtils
import android.view.View
import android.widget.TextView
import com.chad.library.adapter.base.BaseQuickAdapter
import com.chad.library.adapter.base.module.LoadMoreModule
import com.chad.library.adapter.base.viewholder.BaseViewHolder
import com.zat.mes.andrmes.R
import com.zat.mes.andrmes.data.BadFlatItem
import com.zat.mes.andrmes.data.GetPackBean
import com.zat.mes.andrmes.data.Itemm

/**
 * @author zy
 * @date :2020-02-22 09:28
 * @description: 选择排班
 */
class SelectBadFlatAdapter(layoutResId: Int) :
    BaseQuickAdapter<BadFlatItem, BaseViewHolder>(layoutResId), LoadMoreModule {

    var selectPosition:Int = -1
    override fun convert(helper: BaseViewHolder, item: BadFlatItem) {

        helper.setText(R.id.tvWorkshopNameItemSchedu,item?.scrapsName)
            .setText(R.id.tvNoItemSchedu,item?.inspectionName)
            .setText(R.id.tvDateNameItemSchedu,item?.inspectionDate)

        var tvSelect = helper.getView<TextView>(R.id.btnItemSchedu)
        if (selectPosition == helper.layoutPosition){
            tvSelect.visibility = View.VISIBLE
        }else{
            tvSelect.visibility = View.GONE
        }
        helper.itemView.setOnClickListener {
            selectPosition = helper.layoutPosition
            notifyDataSetChanged()
        }
    }
}